var baseUrl="/apis/admin"
// var baseUrl="http://47.92.251.237/admin"
function myEditor(id,uploadUrl) {
    var E = window.wangEditor;
    var editor = new E(id)
    let _token = getLocalData("_packet_info")['token'] || '';
    editor.customConfig.uploadImgParams = {
        // 如果版本 <=v3.1.0 ，属性值会自动进行 encode ，此处无需 encode
        // 如果版本 >=v3.1.1 ，属性值不会自动 encode ，如有需要自己手动 encode
        token: _token
    }
    editor.customConfig.withCredentials = true
    editor.customConfig.uploadImgServer = baseUrl+uploadUrl;
    editor.customConfig.uploadFileName = 'file'
    editor.customConfig.uploadImgHooks = {
        before: function (xhr, editor, files) {
        },
        success: function (xhr, editor, result) {
        },
        fail: function (xhr, editor, result) {
        },
        error: function (xhr, editor) {
        },
        timeout: function (xhr, editor) {
        },
        customInsert: function (insertImg, result, editor) {
            var url = result.body.downloadUrl;
            console.log(url)
            insertImg(url);
        }
    }

    // 隐藏“网络图片”tab
    editor.customConfig.showLinkImg = false
    editor.create()
    return editor;

}